<template>
  <el-menu text-color="#C0CED9" background-color="#304156">
    <router-link to="/Index.vue">
    <el-menu-item index="1"  v-if=" state == 0 ||state == 1 || state == 2 || state == 3? true : false"> 
      首页 
      </el-menu-item></router-link>

  <router-link to='/channel'>
    <el-menu-item index="2" v-if="(state==1 || state==0)?true:false">渠道酬金管理</el-menu-item>
    <el-menu-item index="2" v-if=" state == 2 || state == 3? true : false"
      >渠道酬金管理</el-menu-item
    ></router-link>

    <el-submenu index="3" v-if="state == 1  || state == 3? true : false">
      <template slot="title">业务办理</template>
      <router-link to="/adduser"><el-menu-item index="3-1">挂载用户</el-menu-item></router-link>
      <router-link to="/business"><el-menu-item index="3-2">业务使用</el-menu-item></router-link>
    </el-submenu>

    <router-link to='/initiateAudit'>    <el-menu-item index="4" v-if="state == 1 || state == 2 || state == 3? true : false"
      >酬金申请</el-menu-item
    ></router-link>

    <el-submenu index="5" v-if="state == 2 || state == 3? true : false">
      <template slot="title">酬金政策管理</template>
      <router-link to="/maintain"><el-menu-item index="2-1">酬金政策维护</el-menu-item></router-link>
      <router-link to="/condition"> <el-menu-item index="1-2">条件类型管理</el-menu-item></router-link>
      <router-link to="/model">
      <el-menu-item index="2-3">政策模板配置</el-menu-item></router-link>
    </el-submenu>

    <el-submenu index="6" v-if="state == 1 || state == 2 || state == 3? true : false">
      <template slot="title">酬金结果报表</template>

      <router-link to="/cenji"><el-menu-item index="6-1">酬金明细</el-menu-item></router-link>
    </el-submenu>

    <el-submenu index="7" v-if=" state == 1 || state == 2 ||state == 3? true : false">
      <template slot="title">酬金结果管理</template>
      <router-link to="/examineContent"><el-menu-item index="4-1">酬金审核</el-menu-item></router-link>
      <router-link to="/adjustment">
      <el-menu-item v-if=" state == 2 ||state == 3? true : false" index="4-2">酬金调账</el-menu-item>
      </router-link>
    </el-submenu>

    <el-submenu index="8" v-if="state == 2 || state == 3? true : false">
      <template slot="title">同步数据</template>
<!--      <router-link to="/paymentRemuneration"> <el-menu-item index="5-1">酬金发放反馈</el-menu-item></router-link>-->
     <router-link to="/Tax.vue"> <el-menu-item index="5-2">税率配置</el-menu-item></router-link>
    </el-submenu>

    <el-submenu index="9" v-if="state == 2 || state == 3 ? true : false">
      <template slot="title">
        <span>权限管理</span>
      </template>
      <router-link to="/quanxian.vue">
        <el-menu-item index="6-1" v-if="state == 3 ? true : false">
          权限级别
        </el-menu-item>
      </router-link>
      <router-link to="/glquanxian.vue">
        <el-menu-item index="6-2" v-if="state == 2 || state == 3? true : false">
          管理更改
        </el-menu-item>
      </router-link>
    </el-submenu>
  </el-menu>
</template>

<script>
export default {
  name: "leftMenu",
  data() {
    return {
      state: this.$store.state.userInfo.userAction,
      
    };
  },
  mounted: function() {
    this.getDeptList();
  },
  methods: {
    getDeptList: function() {
      this.$axios
        .get("api/user/selectAll", {})
        .then((res) => {
          let result = res.data;
          if (result.code == 200) {
            console.log(result);
            this.userAction = result.data.userAction;
          } else {
            this.$alert(result.msg);
          }
        })
        .catch(() => {});
    },
  },
};
</script>

<style scoped>
a {
  text-decoration: none;
}
.el-menu-item.is-active {
  color: white;
  background-color: #263445 !important;
}
.el-menu-item {
  height: 60px;
  line-height: 60px;
}
.el-menu {
  text-align: left;
  letter-spacing: 1px;
  border: 0;
  border-right-width: 0;
}
.if {
  display: block;
}
.hide {
  display: none;
}
</style>
